import * as THREE from 'three'
import cameraModule from './camera'
import rendererModule from './renderer'
import controlModule from './controls'
import scene from './scene'
import { updateMesh } from '@/three/createMesh'

const clock = new THREE.Clock()
function animate(t) {
    // const item = clock.getElapsedTime()
    const time = clock.getDelta()
    controlModule.controls.update(time)
    updateMesh(time)
    requestAnimationFrame(animate)
    rendererModule.renderer.render(scene, cameraModule.activeCamera)
    rendererModule.css3drenderer.render(scene, cameraModule.activeCamera)
}

export default animate